<#assign  title="保单确认页面" />
<#include 'common/header.html' />
<style>
    .good_list .title{color:#fff;}
</style>
<div class="h-btm">
    <div class="flow-steps">
        <div class="logo">
            <a href="${ctx}/index.html">
                <@image src="${site.logofile!''}" title="logo"/>
            </a>
        </div>
        <span style="font-size: 30px;color: orangered">订单提交界面</span>
    </div>
</div>
<div class="mycar-index">
    <form role="form">
        <div class="insrance" style="margin-left: 15%;margin-right: 15%">
            <span>投保人信息</span><br/>
            <div class="form-group">
                <input type="text" id="warranty_number" name="warranty_number" value="${warranty.warranty_number}"/>
                <label for="name">姓名</label><input type="text" class="form-control" id="name" name="applicant_name" value="${warranty.applicant_name}" readonly/>
            </div>
            <div class="form-group">
                <label for="name">电话</label><input type="text" class="form-control" id="name" name="policy_mobile" value="${warranty.policy_mobile}" readonly/>
            </div>
            <div class="form-group">
                <label for="name">身份证</label><input type="text" class="form-control" id="name" name="policy_idcard" value="${warranty.policy_idcard}"/>
            </div>
            <div class="form-group">
                <label for="name">住址</label><input type="text" class="form-control" id="name" name="policy_address" value="${warranty.policy_address}"/>
            </div>
        </div>
            <h3>发票信息 <a href="javascript:;" class="c-new-receipt" style="float: right; color: #337ab7; font-size: 12px;"></a></h3>
            <script type="text/javascript" src="${ctx}${themes_path}/js/checkout-receipt.js"></script>
            <!--发票信息 start-->
<div class="ckt-item invoice">
    <div class="top-ckt">
         <div class="clearfix"></div>
     </div>
            <div class="content-ckt invoice">
                            <#assign receiptListTag = newTag("receiptListTag") />
                            <#assign receiptList = receiptListTag() />
                            <#list receiptList as receipt>
                                <#if receipt.is_default == 1>
                                    <#assign defaultReceipt = receipt />
                                </#if>
                            </#list>
            <div class="receipt-title"><#if defaultReceipt??>${defaultReceipt.title}</#if></div>
            <div class="receipt-content"><#if defaultReceipt??>${defaultReceipt.content}<#else/>无需发票</#if></div>
            <a href="javascript: void(0);" class="edit-invoice">修改</a>
                 <#if defaultReceipt??>
                    <a href="javascript: void(0);" class="cancel-invoice" style="margin-left: 10px; color: #ff3500;">取消发票</a>
                </#if>
            <div style="display: none;" id="invoice_content">
                    <div class="invoice-dialog" id="invoice_dialog">
                        <div class="invoice-head">
                            <div class="title-invoice-head">发票抬头：</div>
                            <div class="items-invoice-head" style="margin-bottom: 10px">
                                <div class="ckt-checkbox head-invoice personal">
                                    <span>个人</span>
                                    <input type="text" class="company-invoice-input" value="个人" style="display: none;" />
                                </div>
                                <#list receiptList as receipt>
                                <div class="ckt-checkbox head-invoice company<#if receipt.is_default == 1> selected</#if>">
                                    <div class="__title__">${receipt.title}</div>
                                    <input type="text" class="company-invoice-input" maxlength="30" value="${receipt.title}" data-old_value="${receipt.title}" style="border: none; outline: none;" />
                                    <div class="__btns__">
                                        <a href="javascript:;" class="__edit__">编辑</a>
                                        <a href="javascript:;" class="__update__">保存</a>
                                        <a href="javascript:;" class="__delete__">删除</a>
                                    </div>
                                    <input type="hidden" name="receipt_id" value="${receipt.id}">
                                    <input type="hidden" name="receipt_content" value="${receipt.content}">
                                    <input type="hidden" name="receipt_duty" value="${receipt.duty}">
                                </div>
                                </#list>
                                <#if receiptList?size lt 10 >
                                <div class="ckt-checkbox head-invoice __add_ele__" style="display: none">
                                    <input type="text" class="company-invoice-input" maxlength="60" style="border: none; outline: none;" placeholder="新增单位发票抬头">
                                    <div class="__btns__ show">
                                        <a href="javascript:;" class="__save__">保存</a>
                                    </div>
                                </div>
                                <a href="javascript:;" style="color: #005ea7" class="add-invoice">新增单位发票</a>
                                </#if>
                            </div>
                        </div>
                            <div class="invoice-head duty" style="display: <#if defaultReceipt??>block<#else/>none</#if>">
                                <div class="title-invoice-head" style="margin-top: 10px">纳税人识别号：</div>
                                <input type="text" class="duty-invoice-input" readonly placeholder="纳税人识别号" <#if defaultReceipt??>value="${defaultReceipt.duty}"</#if>>
                            <span style="color: #ff3500">必填</span>
                            </div>
                            <div class="invoice-content">
                                <div class="title-invoice-head">发票内容：</div>
                                <div class="items-invoice-content">
                                    <div class="ckt-checkbox content-invoice<#if defaultReceipt?? && defaultReceipt.content != "明细"><#else/> selected</#if>">
                                    <span>明细</span>
                                    </div>
                                        <#assign receiptContentListTag= newTag("receiptContentListTag") />
                                        <#assign receiptContentList = receiptContentListTag() />
                                        <#list receiptContentList as receiptContent>
                                        <div class="ckt-checkbox content-invoice<#if defaultReceipt?? && defaultReceipt.content == receiptContent.receipt_content> selected</#if>">
                                            <span>${receiptContent.receipt_content}</span>
                                        </div>
                                        </#list>
                                </div>
                            </div>

                            <div class="invoice-inputs" style="display: none;">
                                <#if defaultReceipt??>
                                <!--1: 需要发票  2:不需要发票-->
                                <input type="hidden" name="receipt" value="1">

                                <!--1: 个人  2:单位-->
                                <input type="hidden" name="receiptType" value="2">

                                <!--明细 办公用品 劳保用品 耗材-->
                                <input type="hidden" name="receiptContent" value="${defaultReceipt.content}">

                                <!--单位【公司】名称-->
                                <input type="hidden" name="receiptTitle" value="${defaultReceipt.title}">

                                <!--单位【公司】纳税人识别号-->
                                <input type="hidden" name="receiptDuty" value="${defaultReceipt.duty}">
                                <#else/>
                                <!--1: 需要发票  2:不需要发票-->
                                <input type="hidden" name="receipt" value="2">

                                <!--1: 个人  2:单位-->
                                <input type="hidden" name="receiptType">

                                <!--明细 办公用品 劳保用品 耗材-->
                                <input type="hidden" name="receiptContent">

                                <!--单位【公司】名称-->
                                <input type="hidden" name="receiptTitle">

                                <!--单位【公司】纳税人识别号-->
                                <input type="hidden" name="receiptDuty">
                                </#if>
                            </div>
                    </div>
                </div>
        </div>
</div>
<!--发票信息 end-->
            <div class="box payment">
                <div class="payment_modify" style="display:none">
                    <h3>付款方式</h3>
                    <div class="list">
                        <input type="text" id="payment_name" name="paymant_name" value="信用额度支付" readonly/>
                    </div>
                </div>
            </div>
            </div>
            <div class="remark">
                <span class="remark_title">订单备注：</span>
                <i class="remark_show" name="remark" value=""></i>
                <input name="remark"  type="hidden"/>
                <div class="remark_word" style="display:none">
                    <input type="text" class="remark_intro" placeholder="请写下您的特殊要求，超过30个字我记不住了哦^-^"  value="" maxlength="30"/>
                    <input type="button" class="save_remark" value="保存备注"/>
                </div>
                <i name="xxx" value="1111"/>
            </div>
            <div class="order_total btn-div" >
                <input type="button" id="createBtn" class="enable green-btn" value="确认结算"  />
            </div>
    </form>
<!-- 加载促销活动详细浮动层 -->
<div id="myModal" class="reveal-modal">
    <a class="close-reveal-modal">&#215;</a>
    <div class="goods-add-float" style="word-wrap:break-word; word-break:break-all;">
    </div>
</div>
<!-- 新增地址隐藏显示内容 -->
<div class="checkout-address-append" style="display:none">
    <div class="new-other-address address-append" onclick="add_address();">
        <a href="javascript:void(0)" class="add_address">添加地址</a>
    </div>
</div>
<#include 'common/footer.html'/>
<script type="text/javascript" >
    var Ckt = {};
    $(function(){
        $(function(){
            //默认第一次加载价格
            var regionid = $(".c_addr7").val();
            //如果地址为空，默认地址ID为0
            if(regionid == ""){
                regionid="0";
            }
            var val=$('input:radio[name="typeId"]:checked').val();
            var typy_name=$('input:radio[name="typeId"]:checked').attr("type_name");
            var typeId = $('input:radio[name="typeId"]:checked').val();
            $(".dly_selected").show();
            $(".dly_modify").hide();
            $(".dly_payment i").text(typy_name);
            $(".hidden_dly").val(val);
            $(".hidden_dly").attr("type_name",typy_name);
            //备注
            $(".remark_title").click(function(){
                var _this = $(this);
                if(_this.is('.remark_title_minus')){
                    $(".remark_word").hide();
                    _this.removeClass("remark_title_minus");
                    $(".remark_show").show();
                }else {
                    $(".remark_word").show();
                    _this.addClass("remark_title_minus");
                    $(".remark_show").hide();
                }
            })
            /* 	$(".remark_intro").focus(function(){
                    $(this).val("");
                })
                $(".remark_intro").blur(function(){
                    if($(this).val()==""){
                        $(this).val("请写下您的特殊要求，超过30个字我记不住了哦^-^");
                    }
                }) */
            $(".save_remark").click(function(){
                var remark = $(".remark_intro").val();
                $(".remark_word").hide();
                $(".remark_title").removeClass("remark_title_minus");
                $(".remark_show").show();
                $(".remark_show").text(remark);
                $(".remark_show").attr("value",remark);
                $("input[name='remark']").val(remark);
            })





            //支付方式
            /* $("#savePaymentBtn").click(function(){
                var val=$('input:radio[name="paymentId"]:checked').val();
                var payment_name=$('input:radio[name="paymentId"]:checked').attr("payment_name");
                $(".payment_selected").show();
                $(".payment_modify").hide();
                $(".pay_payment i").text(payment_name);
                $(".hidden_payment").val(val);
            }); */

            //支付方式
            $("#savePaymentBtn").click(function(){
                    $.ajax({
                        url: "${ctx}/app/warranty/addWarrantyOrder.do",
                        async: false,
                        data:"regionList="+addList,
                        dataType: "json",
                        type: "POST",
                        success: function (result) {
                            if(result.result==0){
                                alert(result.message);
                            }else{
                                var val=$('input:radio[name="paymentId"]:checked').val();
                                var payment_name=$('input:radio[name="paymentId"]:checked').attr("payment_name");
                                $(".payment_selected").show();
                                $(".payment_modify").hide();
                                $(".payment_modify").attr("isClose","1");
                                $(".pay_payment i").text(payment_name);
                                $(".hidden_payment").val(val);
                            }
                        }
                    });
                }else{
                    var val=$('input:radio[name="paymentId"]:checked').val();
                    var payment_name=$('input:radio[name="paymentId"]:checked').attr("payment_name");
                    $(".payment_selected").show();
                    $(".payment_modify").hide();
                    $(".payment_modify").attr("isClose","1");
                    $(".pay_payment i").text(payment_name);
                    $(".hidden_payment").val(val);
                }
            });

            $(".payment_btn").click(function(){
                $(".payment_selected").hide();
                $(".payment_modify").show();
                $(".payment_modify").attr("isClose","0");
            });

        });


        //结算悬停
        $("#createBtn").mouseover(function(){
            $(this).addClass("order_light");
        })
        $("#createBtn").mouseleave(function(){
            $(this).removeClass("order_light");
        })

        //显示促销活动详细
        $(".act_detail").click(function(){
            var actId = $(this).attr("act_id");
            $(".goods-add-float").load("detail/activity_detail.html?activityId="+actId);
        })
    function getJson(){

    }
</script>